//
// Created by nicemoe on 2021/8/8.
//

#include  <iostream>

using namespace std;
const int ArSize = 8;

int sum_arr(const int arr[], int n);

int main()
{
    int cookies[ArSize]
            {
                    1, 2, 3, 8, 16, 32, 64, 128
            };
    cout << &cookies << endl;
    int sum = sum_arr(cookies, ArSize);
    cout << endl;
    cout << "Total cookies eaten: " << sum;
    return 0;
}

int sum_arr(const int *arr, int n)
{
    int total = 0;
    //打印arr数组地址
    cout << &arr << endl;
    for (int i = 0; i < n; i++)
    {
        total += arr[i];
    }
    return total;
}